Those skilled in the art know that SQL (Structured Query Language) is the most popular query language when the data has been stored in a relational database. Another example of a query language is XQuery, for data that has been stored in XML format.
The principal use for such query languages has traditionally been as part of a larger software system, where the application program issues queries (in SQL or XQuery) to an information retrieval component. In this usage scenario, queries are rarely written by hand; instead they are generated by the software system itself. Where they are written by hand, the author is typically an expert who is well-trained in query technologies.
Because of this usage within larger systems by experts, it has been possible to simultaneously design queries and the format of the data to be searched. If a query is awkward to express, or inefficient, the representation of the data can be adapted to circumvent these problems.
The above assumptions are however no longer valid in certain recent applications, such as a query interface to a wiki site, (i.e. a site that allows users to freely create and edit Web page content using any Web browser. Wiki supports hyperlinks and has a simple text syntax for creating new pages and crosslinks between internal pages on the fly), where many ad hoc queries are written by non-expert users and the design of the data representation cannot be changed to facilitate queries. Since these ad hoc queries are written by people and not by systems, it is important to be able to draw on libraries of existing queries, so that awkward details of the data representation can be encapsulated as common operations, allowing the query author to pose questions in the vocabulary of the problem domain that is familiar to the author.
Accordingly, what is desired, and which has not until now been developed, is a method and apparatus, embodied as a query language, that allows the construction of re-usable queries, so that non-experts can phrase questions in the vocabulary of the problem domain. Furthermore queries in such a language should be concise and easy to read. Finally the language should be close in syntax to mainstream programming languages, so it is easy to learn for those who already have some programming experience.